#ifndef __MUTEX_LOCK_H__
#define __MUTEX_LOCK_H__

#include <pthread.h>
#include <boost/utility.hpp>

namespace mars {

class Condition;
class MutexLock : boost::noncopyable {
    friend class Condition;
    public:
        MutexLock();
        ~MutexLock();
        void lock();
        void unlock();
    private:
        pthread_mutex_t* get_pthread_mutex();
    private:
        pthread_mutex_t _mutex;
};

class MutexLockGuard : boost::noncopyable {
    public:
        MutexLockGuard(MutexLock& lock);
        ~MutexLockGuard();
    private:
        MutexLock &_lock;
};

} // namespace mars

//#define MutexLockGuard(x) static_assert(false, "missing mutex guard var name")

#endif //__MUTEX_LOCK_H__

